#!/bin/bash

identifierList=("b23acbc0-a6cc-4ad5-9ae8-0d5f0626b6b4" \
                "c5a34643-1540-46f3-aff9-57a2873b5cad" \
                "5fd310ae-176f-3a2e-a409-844320eaa33b" \
                "6ecc749d-6d44-43ba-b2de-47bd16355256" \
                "506788a0-0b4e-11dd-9669-00008a07204e" \
                "d63dc150-0d02-11dd-bbbb-00008a07204e" \
                "f81fc09e-a5b9-48c1-8315-975fb6209c7b" \
                "bf59f8ef-e8e9-48d3-aeb4-1b217154b941" )

    rm ForIMOS/IMOSRegistryObjects.xml
    
    for i in ${!identifierList[*]}
    do
        uri="http://imosmest.aodn.org.au:80/geonetwork/srv/en/oaipmh?verb=GetRecord&identifier=${identifierList[$i]}&metadataPrefix=iso19139.mcp" 
        printf "$uri\n" 

        echo wget --header='Accept-Language: en-us' $uri -O ${identifierList[$i]}_wget.xml
        wget --header='Accept-Language: en-us' $uri -O ${identifierList[$i]}_wget.xml
        
        echo "Moving on..."

        echo "java -jar /home/anucsiro/workspace/XML/XSLT/saxon9he.jar ${identifierList[$i]}_wget.xml /home/anucsiro/workspace/XML/XSLT/ISO19139_To_RIFCS/IMOS/IMOS_rif.xsl > ForIMOS/${identifierList[$i]}_rif-cs.xml"

        java -jar /home/anucsiro/workspace/XML/XSLT/saxon9he.jar ${identifierList[$i]}_wget.xml /home/anucsiro/workspace/XML/XSLT/ISO19139_To_RIFCS/IMOS/IMOS_rif.xsl > ForIMOS/${identifierList[$i]}_rif-cs.xml

        cat ForIMOS/${identifierList[$i]}_rif-cs.xml >> ForIMOS/IMOSRegistryObjects.xml

    done


